package com.xuzhiguang.baidu.pan.sdk.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.util.List;

/**
 * @author xuzhiguang
 * @date 2020/6/27 3:31
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public class UploadPreCreateResult extends BaiduPanCommonResult {

    /**
     * 文件的绝对路径
     */
    private String path;

    /**
     * 上传id
     */
    private String uploadid;

    /**
     * 返回类型，1 文件在云端不存在、2 文件在云端已存在
     */
    private Integer returnType;

    /**
     * 需要上传的分片序号，索引从0开始
     */
    private List<Integer> blockList;

    /**
     * returnType = 2时返回，秒传成功
     */
    private Info info;

    @Override
    public String toString() {
        return "UploadPreCreateResult{" +
                "super=" + super.toString() + '\''+
                ", path='" + path + '\'' +
                ", uploadid='" + uploadid + '\'' +
                ", returnType=" + returnType +
                ", blockList=" + blockList +
                ", info=" + info +
                '}';
    }

    public Info getInfo() {
        return info;
    }

    public void setInfo(Info info) {
        this.info = info;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getUploadid() {
        return uploadid;
    }

    public void setUploadid(String uploadid) {
        this.uploadid = uploadid;
    }

    public Integer getReturnType() {
        return returnType;
    }

    public void setReturnType(Integer returnType) {
        this.returnType = returnType;
    }

    public List<Integer> getBlockList() {
        return blockList;
    }

    public void setBlockList(List<Integer> blockList) {
        this.blockList = blockList;
    }

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Info {

        /**
         * 请求id
         */
        private Long requestId;

        /**
         * 文件在云端的唯一标识ID
         */
        private Long fsId;

        /**
         * 文件的MD5，只有提交文件时才返回，提交目录时没有该值
         */
        private String md5;

        /**
         * 文件名
         */
        private String serverFilename;

        /**
         * 分类类型, 1 视频 2 音频 3 图片 4 文档 5 应用 6 其他 7 种子
         */
        private Integer category;

        /**
         * 	上传后使用的文件绝对路径
         */
        private String path;

        /**
         * 文件大小，单位B
         */
        private Long size;

        /**
         * 	文件创建时间
         */
        private Long ctime;

        /**
         * 	文件修改时间
         */
        private Long mtime;

        /**
         * 是否目录，0 文件、1 目录
         */
        private Integer isdir;

        @Override
        public String toString() {
            return "Info{" +
                    "requestId=" + requestId +
                    ", fsId=" + fsId +
                    ", md5='" + md5 + '\'' +
                    ", serverFilename='" + serverFilename + '\'' +
                    ", category=" + category +
                    ", path='" + path + '\'' +
                    ", size=" + size +
                    ", ctime=" + ctime +
                    ", mtime=" + mtime +
                    ", isdir=" + isdir +
                    '}';
        }

        public Long getRequestId() {
            return requestId;
        }

        public void setRequestId(Long requestId) {
            this.requestId = requestId;
        }

        public Long getFsId() {
            return fsId;
        }

        public void setFsId(Long fsId) {
            this.fsId = fsId;
        }

        public String getMd5() {
            return md5;
        }

        public void setMd5(String md5) {
            this.md5 = md5;
        }

        public String getServerFilename() {
            return serverFilename;
        }

        public void setServerFilename(String serverFilename) {
            this.serverFilename = serverFilename;
        }

        public Integer getCategory() {
            return category;
        }

        public void setCategory(Integer category) {
            this.category = category;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public Long getSize() {
            return size;
        }

        public void setSize(Long size) {
            this.size = size;
        }

        public Long getCtime() {
            return ctime;
        }

        public void setCtime(Long ctime) {
            this.ctime = ctime;
        }

        public Long getMtime() {
            return mtime;
        }

        public void setMtime(Long mtime) {
            this.mtime = mtime;
        }

        public Integer getIsdir() {
            return isdir;
        }

        public void setIsdir(Integer isdir) {
            this.isdir = isdir;
        }
    }

}
